package com.hrhx.springboot.service;

import java.io.IOException;
import java.util.Map;

import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;

import com.hrhx.springboot.util.JsonUtil;

@Service
public class IdCardService {
	
	@Value("classpath:static/data.json")
    private Resource info;
	
	public String getIdCardByIdSix(String sixCode) throws IOException{	
		Map<String, Object> map = JsonUtil.toMap(JsonUtil.parseJson(injectInfo()));
		return map.get(sixCode).toString();
	}
	
	private String injectInfo() throws IOException{
        return IOUtils.toString(info.getInputStream());
    }
}
